#存款买房-B
total_cost = float(input())           # total_cost为当前房价
annual_salary = float(input())        # 年薪
portion_saved = float(input()) / 100  # 月存款比例，输入30转为30%
semi_annual_raise = float(input()) /100     # 输入每半年加薪比例，输入7转化为7%
portion_down_payment = 0.3      # 首付比例，浮点数
# 补充你的代码，计算首付款     
def down_payment():
    down_payment = total_cost * portion_down_payment
    return down_payment
down_payment = down_payment()
print(f'首付 {down_payment:.2f} 元')

current_savings = 0                                # 存款金额，从0开始
number_of_months = 1
monthly_salary = annual_salary/12                  # 月工资
monthly_deposit = monthly_salary * portion_saved   # 月存款
# 计算多少个月才能存够首付款，结果为整数，不足1月按1个月计算，即向上取整
# 补充你的代码 
def print_current(number_of_months, monthly_salary, semi_annual_raise, monthly_deposit ):
    enough = True
    current_saving = 0
    while enough:
        current_saving = current_saving + monthly_deposit  # 发工资了，先给自己存一笔
        if current_saving >= down_payment:  # 存够了买房去
            print(f'需要{number_of_months}个月可以存够首付')
            enough = False
            return
        if number_of_months % 12 == 0:
            print("第{}个月月末有{:,.0f}元存款".format(number_of_months, current_saving))  # 每12个月输出一次存款，保留0位小数，使用千分符
        if number_of_months % 6 == 0:
            monthly_deposit = monthly_deposit * (1 + semi_annual_raise)  # 六月之期已到，加薪
        number_of_months = number_of_months + 1
print_current(number_of_months, monthly_salary, semi_annual_raise, monthly_deposit)